<html>
	<head>
		<meta charset="utf-8"/>
		<title>Ajax测试页面</title>
		<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript">
			function testLogin() {
				var userName = $("#userName").val();
				var userPwd = $("#userPwd").val();
				console.log("userName == " + userName);
				var param="userName="+userName+"&userPwd="+userPwd;
				$.ajax({
					url:"ajax.asp",
					datatype:"json",
					type:"post",
					data:param,				//发送HTTP请求的参数数据参数名=参数值&参数名=参数值
					success:function(data){
						$("#mydiv").html(data);
						//服务端响应编码为200的
						//请求成功的回调方法
					},
					error:function() {
						//响应编码不为200的
					}
				});
				
			}
			
		</script>
	</head>
	<body>
		<div align="center" id="mydiv">
		
		</div>
		<table>
			<tr> 
				<td>用户名:</td>
				<td><input type="text" id="userName" name="userName"/></td>
			</tr>
			<tr>
				<td>密码:</td>
				<td><input type="password" id="userPwd" name="userPwd"/></td>
			</tr>	
			<tr>
				<td align="center" colspan="2" >
					<input type="button" value="测试登录" onClick="testLogin()"/>
				</td>
			</tr>		
		</table>
	</body>
</html>